package com.sen.service;

import com.sen.mapper.EmployeeMapper;
import com.sen.pojo.Employee;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Collection;

@Service
public class EmployeeService {

    @Autowired
    EmployeeMapper employeeMapper;


    //增加一个员工
    public void save(Employee employee){
        employeeMapper.save(employee);
    }

    //查询全部员工信息
    public Collection<Employee> getAll(){
        return employeeMapper.getAll();
    }

    //通过id查询员工
    public Employee getEmployeeById(Integer id){
        return employeeMapper.getEmployeeById(id);
    }

    //通过id删除员工
    public int deleteEmployeeById(Integer id){
        return employeeMapper.deleteEmployeeById(id);
    }

    //通过id更新员工
    public int updateEmployeeById(Employee employee){
        return employeeMapper.updateEmployeeById(employee);
    }
}
